
/*
This file is part of MJIN2.

Copyright (C) 2012-2013 Opensource Game Studio

This software is provided 'as-is', without any express or implied
warranty.  In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
   claim that you wrote the original software. If you use this software
   in a product, an acknowledgment in the product documentation would be
   appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
   misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#ifndef MJIN2_SOUND_SOURCE_STREAM_H
#define MJIN2_SOUND_SOURCE_STREAM_H

#include <mjin2/ListenerMacros.h>
#include <mjin2/SoundSource.h>

class alureStream;

namespace mjin2
{

//! Class for Sound Source Stream
class SoundSourceStream : public SoundSource
{
    public:
        MJIN2_LISTENER(
            virtual void onSoundSourceStateChanged(SOUND_SOURCE_STATE /*state*/) { }
        );

    public:
        SoundSourceStream() throw (Exception);
        virtual ~SoundSourceStream() throw ();

        //! Has effect only before the source has been started.
        void setLooping(bool isLooping) throw (Exception);
        void setStream(const char *name) throw (Exception);
        //! \exception "Invalid sound state"
        //! Only SOUND_SOURCE_STATE_PAUSED, SOUND_SOURCE_STATE_PLAYING, SOUND_SOURCE_STATE_STOPPED allowed.
        //! No effect when the source is disabled.
        void setState(SOUND_SOURCE_STATE state) throw (Exception);
        SOUND_SOURCE_STATE state() const throw (Exception);

    protected:
        alureStream *mStream;
        SOUND_SOURCE_STATE mState;
        bool mLooping;
};

} // namespace mjin2

#endif // MJIN2_SOUND_SOURCE_STREAM_H
